home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / amos / amoslist-1294.lzh / AMOSLIST / text0002.txt < prev    next >
Encoding:
Text File  |  1995-01-03  |  2.9 KB  |  76 lines

  1.  
  2. [...]
  3.  
  4. > Now, EasyLife's structures seems to be a promising alternative to the above.
  5. > But! There's a few things I believe would be limiting factors to both speed
  6. > and functionality. I'd appriciate some comments on these.
  7. > 1. Structures will have to be accessed through Amos' string/variable system
  8. >    which will slow down adding/reading big quantaties of data.
  9. The delay on everything except strings would be neglibigle - after all, 
  10. copying an
  11. integer so only a move instruction or two. If you have the capability to load 
  12. your
  13. strings at a particular memory address, you can use St Get (As opposed to St 
  14. Get$)
  15. to obtain the address of the string, which for example could be passed as the 
  16. buffer
  17. address of a DOS library Read() call to load directly into a buffer.
  18.  
  19. > 2. String searching and sorting will be much slower than it would be if I
  20. >    used banks.
  21.  
  22. Not necessarily. Depends on how you organised the banks. With structures it is 
  23. particularly easy to build trees which can be very quickly searched ( Order 
  24. log n)
  25. if the elements are inserted in order. And for sorting, you won't have to copy 
  26. the
  27. strings around - just change the pointers. You may get some help from a 
  28. computer
  29. science text book on abstract data types, most of which go into great detail 
  30. about 
  31. the different types of data structures you can build with pointers, and the 
  32. efficiency
  33. of reading / changing each. They will also give you some good sorting 
  34. algorithmns.
  35.  
  36. A good example of where structured variables are faster is the easylife 
  37. variable checker,
  38. which runs 2-3 times faster now I have changed it to store the internal lists 
  39. of variable
  40. names in structures. I am also currently adapting an asteroids game I once 
  41. wrote to use
  42. structures.
  43.  
  44. The number of instructions executed during the average structure access is not 
  45. very
  46. high - the only loops occur in finding the correct structure if an element 
  47. name is used
  48. in more than one, and in processing the indexes of arrays. Other than that it 
  49. is basically
  50. a fairly short bit of straight line code - The differicult bits were the 
  51. memory allocator,
  52. and the initial structures compiler program (Later versions used structured 
  53. variables
  54. themselves).
  55.  
  56.  
  57. On the MUI front I'd be interested to hear your (and anyone elses) ideas, as I 
  58. don't
  59. think many people have used that.
  60.  
  61.  
  62. +-------------------------+------------------------------------+
  63. |                         |    _____                           |
  64. | PAUL HICKMAN            |   /     \   ON A HOT SUMMER NIGHT  |
  65. | (ph@doc.ic.ac.uk)       |  /  O O  \  WOULD YOU  OFFER YOUR  |
  66. | DEPARTMENT OF COMPUTING | |    _    | THROAT  TO  THE  WOLF  |
  67. | IMPERIAL COLLEGE LONDON |  \  / \  /  WITH THE RED  ROSES ?  |
  68. |                         |   \_____/                          |
  69. +-------------------------+------------------------------------+
  70. Machines: Amiga 500  WB1.3 - 1mb Memory - External Disk Drive.
  71.           Amiga 1200 WB3.0 - 6mb Memory - 200Mb Hard Disk.
  72.  
  73.  
  74.